package online.inote.naruto.utils.time;

import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * @description 日历
 * @author gaopengsui@creditease.cn
 * @date 2021/10/18 4:11 下午
 */
public class Calendar {

  /**
   * 是否工作日
   *
   * @param dateTime 日期时间
   * @return 结果
   */
  public static <T> boolean isWorkDay(Comparable<T> dateTime) {
    return true;
  }

  public static boolean isWorkDay(Date date) {
    return true;
  }

  public static <T extends Comparable> List<T> workDay(Collection<T> dateList) {

    List<T> workDayList = new ArrayList<>();

    if (CollectionUtils.isNotEmpty(dateList)) {
      dateList.forEach(
          date -> {
            if (isWorkDay(date)) {
              workDayList.add(date);
            }
          });
    }

    return workDayList;
  }

  public static List<Date> workDay(List<Date> dateList) {
    List<Date> workDayList = new ArrayList<>();

    if (CollectionUtils.isNotEmpty(dateList)) {
      dateList.forEach(
          date -> {
            if (isWorkDay(date)) {
              workDayList.add(date);
            }
          });
    }

    return workDayList;
  }
}
